<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE6">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<link rel="shortcut icon" href="<%=basePath%>favicon.ico" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/all_b.css?20161126">
<script type="text/javascript">var basePath = "<%=basePath%>";</script>
<script type="text/javascript"
	src="<%=basePath%>js/jquery.min.js?20161126"></script>
<script type="text/javascript"
	src="<%=basePath%>js/layer/layer.js?20161126"></script>
<title>实时投注情况监控 - 管理员</title>
</head>
<body style="" id="bodyModule">
	<jsp:include page="../commons/manage_head.jsp" flush="true"></jsp:include>
	<div id="layout" class="container" style="height: 666px;">
		<div style="display: block;" id="rightLoader"
			class="main-content bet-content">
			<div id="memberList" class="page">
				<h3 class="lh2" style="color: #063863; margin-bottom: 4px;">
					<b class="reder">${time}</b>---投注监控情况&nbsp;&nbsp;<a id="loadNum" href="javascript:void(0)" style="text-align: enter">历史...</a>
					&nbsp;&nbsp;<a id="loadNumNow" href="javascript:void(0)" style="text-align: enter">最新...</a>
				</h3>
				<table class="bet-table z3-table" id="memeber_tb">
					<thead>
						<tr>
							<th>
								用户
							</th>
							<th>
								单号
							</th>
							<th>
								时间
							</th>
							<th>
								ip
							</th>
							<th>
								类型
							</th>
							<th>
								玩法
							</th>
							<th>
								下注金额
							</th>
							<th>
								可赢金额
							</th>
							<th>
								投注结果
							</th>
						</tr>
					</thead>
					<tbody id="accounts_tb"></tbody>
				</table>
			</div>
		</div>
	</div>
	<div class="footer">
		<div class="marquee">
			<p class="marqueeBox">
				<marquee id="marqueeBox" scrollamount="2">欢迎光临...........</marquee>
			</p>
		</div>
	</div>
</body>
<script type="text/javascript">
	$(function(){
		 $(document).bind("contextmenu",function(e){   
	       return false;   
	 	 });
		 var page  = 1;
		 playDate(page);
		 $('#loadNum').click(function(){
			 page++;
			 $("#accounts_tb").html("");
			 playDate(page);
		 });
		 $('#loadNumNow').click(function(){
			 page =1;
			 playDate(page);
		 });
	});  
    Date.prototype.format = function (format) {  
        var o = {  
            "M+": this.getMonth() + 1,  
            "d+": this.getDate(),  
            "h+": this.getHours(),  
            "m+": this.getMinutes(),  
            "s+": this.getSeconds(),  
            "q+": Math.floor((this.getMonth() + 3) / 3),  
            "S": this.getMilliseconds()  
        }  
        if (/(y+)/.test(format)) {  
            format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));  
        }  
        for (var k in o) {  
            if (new RegExp("(" + k + ")").test(format)) {  
                format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));  
            }  
        }  
        return format;  
    }
    // js转换时间格式
	function getFormatDateByLong(l, pattern) {  
        return getFormatDate(new Date(l), pattern);  
    }
	function getFormatDate(date, pattern) {  
        if (date == undefined) {  
            date = new Date();  
        }  
        if (pattern == undefined) {  
            pattern = "yyyy-MM-dd hh:mm:ss";  
        }  
        return date.format(pattern);  
    }
	// 加载投注
	function playDate(page) {  
		var index,html;
		$.ajax({
			    url:basePath+"manage/cathectic",dataType:"json",async:true,data:{"page":page,"t":Math.random()},type:"GET",
			    beforeSend:function(){
			    	index = layer.load(1, {
			    	  shade: [0.1,'#fff']
			    	});
			    },success:function(req){
			        if(req.resultCode == '5'){
						layer.msg("登录已失效，请重新登录");
						return;
					}
			        if(req.resultCode == '6'){
						layer.msg("该请求没有权限");
						return;
					}
			    	$.each(req.dataList, function(i, item) {
			    		var isWin = item.isWin;
			    		var dictRate = item.dictRate;
			    		var cathecticInt = item.cathecticInt;
			    		var winAmt = parseFloat(item.winAmt);
			    		var win;
			    		if(isWin == 0){
			    			win = "未开奖";
			    		}
			    		if(isWin == 1){
			    			win = "赢";
			    		}
			    		if(isWin == 2){
			    			win = "输";
			    		}
			    		html += "<tr><td>"+item.createUser+"</td><td>"+item.cathecticNum+"</td><td>"+getFormatDateByLong(item.createTime,'yyyy-MM-dd hh:mm:ss')+"</td>";
			    		html += "<td>"+item.cathecticIp+"</td><td>北京赛车(PK10)-"+item.termCd+"期</td><td>"+item.cathecticCodeStr+"@赔率"+dictRate+"</td><td>"+cathecticInt+"</td><td>"+winAmt.toFixed(2)+"</td><td>"+win+"</td></tr>";
			        });
			    	$("#accounts_tb").append(html);
			    	page++;
			    },complete:function(){
			    	layer.close(index);
			    },error:function(){
			    	layer.msg("网络异常请重试");
			    }
		});
    }
</script>
</html>